<!DOCTYPE html>
<html>
  <head>
    <meta charset='utf-8'>
    <meta content='width=device-width, initial-scale=1.0' name='viewport'>
    <meta content='' name='description'>
    <meta content='Nils Nordman' name='author'>
    <link href='/images/howl.png' rel='shortcut icon'>
    <title>Howl :: Spec - howl.interactions.file_selection</title>
    <link href="/stylesheets/bootstrap.min.css" media="screen" rel="stylesheet" type="text/css" />
    <link href="/stylesheets/syntax.css" media="screen" rel="stylesheet" type="text/css" />
    <link href="/stylesheets/howl.css" media="screen" rel="stylesheet" type="text/css" />
    <script src="https://code.jquery.com/jquery-1.12.3.min.js" type="text/javascript"></script>
    <script src="/javascripts/bootstrap.min.js" type="text/javascript"></script>
    
    <link href='//fonts.googleapis.com/css?family=Josefin+Slab' rel='stylesheet' type='text/css'>
    <link href='//fonts.googleapis.com/css?family=Open+Sans+Condensed:700' rel='stylesheet' type='text/css'>
  </head>
  <body class='doc doc_spec doc_spec_interactions doc_spec_interactions_file_selection_spec'>
    <div class='container'>
      <div class='masthead'>
        <ul class='nav nav-pills'>
          <li>
            <a href='/'>
              <span class='glyphicon glyphicon-home'></span>
              Home
            </a>
          </li>
          <li>
            <a href='/doc/'>
              <span class='glyphicon glyphicon-book'></span>
              Documentation
            </a>
          </li>
          <li>
            <a href='/blog/'>
              <span class='glyphicon glyphicon-bullhorn'></span>
              Blog
            </a>
          </li>
          <li>
            <a href='/contact.html'>
              <span class='glyphicon glyphicon-inbox'></span>
              Contact
            </a>
          </li>
        </ul>
      </div>
      <ol class="breadcrumb"><li><a href="/">Home</a></li><li><a href='../../'>Howl Documentation (master branch)</a></li><li>Spec</li><li>Interactions</li><li>Spec - howl.interactions.file_selection</li></ol>
      <div class="spec-group spec-group-1">&#x000A;&#x000A;<h1 id="howl.interactions.file_selection">howl.interactions.file_selection</h1>&#x000A;&#x000A;<pre class="highlight moonscript"><span class="kd">local</span><span class="w"> </span><span class="n">tmpdir</span><span class="p">,</span><span class="w"> </span><span class="n">command_line</span><span class="w">&#x000A;&#x000A;</span><span class="n">before_each</span><span class="w"> </span><span class="o">-&gt;</span><span class="w">&#x000A;  </span><span class="k">for</span><span class="w"> </span><span class="n">buf</span><span class="w"> </span><span class="k">in</span><span class="w"> </span><span class="o">*</span><span class="n">app</span><span class="p">.</span><span class="n">buffers</span><span class="w">&#x000A;    </span><span class="n">app</span><span class="o">\</span><span class="n">close_buffer</span><span class="w"> </span><span class="n">buf</span><span class="w">&#x000A;&#x000A;  </span><span class="n">app</span><span class="p">.</span><span class="n">window</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nc">Window</span><span class="o">!</span><span class="w">&#x000A;  </span><span class="n">app</span><span class="p">.</span><span class="n">window</span><span class="o">\</span><span class="n">realize</span><span class="o">!</span><span class="w">&#x000A;  </span><span class="n">app</span><span class="p">.</span><span class="n">editor</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">app</span><span class="o">\</span><span class="n">new_editor</span><span class="o">!</span><span class="w">&#x000A;  </span><span class="n">command_line</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">app</span><span class="p">.</span><span class="n">window</span><span class="p">.</span><span class="n">command_line</span><span class="w">&#x000A;  </span><span class="n">tmpdir</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nc">File</span><span class="p">.</span><span class="n">tmpdir</span><span class="o">!</span><span class="w">&#x000A;&#x000A;</span><span class="n">after_each</span><span class="w"> </span><span class="o">-&gt;</span><span class="w">&#x000A;  </span><span class="n">tmpdir</span><span class="o">\</span><span class="n">rm_r</span><span class="o">!</span><span class="w">&#x000A;  </span><span class="k">for</span><span class="w"> </span><span class="n">buf</span><span class="w"> </span><span class="k">in</span><span class="w"> </span><span class="o">*</span><span class="n">app</span><span class="p">.</span><span class="n">buffers</span><span class="w">&#x000A;    </span><span class="n">app</span><span class="o">\</span><span class="n">close_buffer</span><span class="w"> </span><span class="n">buf</span><span class="w">&#x000A;  </span><span class="n">app</span><span class="p">.</span><span class="n">editor</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="kc">nil</span><span class="w">&#x000A;  </span><span class="n">app</span><span class="p">.</span><span class="n">window</span><span class="o">\</span><span class="n">destroy</span><span class="o">!</span><span class="w">&#x000A;  </span><span class="n">app</span><span class="p">.</span><span class="n">window</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="kc">nil</span></pre>&#x000A;&#x000A;<h4 id="registers-interactions">registers interactions</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><span class="n">assert</span><span class="p">.</span><span class="n">not_nil</span><span class="w"> </span><span class="n">interact</span><span class="p">.</span><span class="n">select_file</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">not_nil</span><span class="w"> </span><span class="n">interact</span><span class="p">.</span><span class="n">select_file_in_project</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">not_nil</span><span class="w"> </span><span class="n">interact</span><span class="p">.</span><span class="n">select_directory</span></pre>&#x000A;<div class="spec-group spec-group-2">&#x000A;&#x000A;<h2 id="interact.select_file">interact.select_file</h2>&#x000A;&#x000A;<h4 id="opens-the-home-directory-by-default">opens the home directory by default</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><span class="kd">local</span><span class="w"> </span><span class="n">prompt</span><span class="w">&#x000A;</span><span class="n">within_activity</span><span class="w"> </span><span class="n">interact</span><span class="p">.</span><span class="n">select_file</span><span class="p">,</span><span class="w"> </span><span class="o">-&gt;</span><span class="w">&#x000A;  </span><span class="n">prompt</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">command_line</span><span class="p">.</span><span class="n">prompt</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">same</span><span class="w"> </span><span class="s1">'~/'</span><span class="p">,</span><span class="w"> </span><span class="n">prompt</span></pre>&#x000A;&#x000A;<h4 id="typing-a-path-opens-the-closest-parent">typing a path opens the closest parent</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><span class="n">prompts</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">{}</span><span class="w">&#x000A;</span><span class="n">within_activity</span><span class="w"> </span><span class="n">interact</span><span class="p">.</span><span class="n">select_file</span><span class="p">,</span><span class="w"> </span><span class="o">-&gt;</span><span class="w">&#x000A;  </span><span class="n">command_line</span><span class="o">\</span><span class="n">write</span><span class="w"> </span><span class="nb">tostring</span><span class="p">(</span><span class="n">tmpdir</span><span class="p">)</span><span class="w">&#x000A;  </span><span class="nb">table.insert</span><span class="w"> </span><span class="n">prompts</span><span class="p">,</span><span class="w"> </span><span class="n">command_line</span><span class="p">.</span><span class="n">prompt</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">same</span><span class="w"> </span><span class="p">{</span><span class="nb">tostring</span><span class="p">(</span><span class="n">tmpdir</span><span class="p">.</span><span class="n">parent</span><span class="p">)</span><span class="w"> </span><span class="o">..</span><span class="w"> </span><span class="s1">'/'</span><span class="p">},</span><span class="w"> </span><span class="n">prompts</span></pre>&#x000A;&#x000A;<h4 id="typing-&quot;/&quot;-after-a-directory-name-opens-the-directory">typing &quot;/&quot; after a directory name opens the directory</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><span class="kd">local</span><span class="w"> </span><span class="n">prompt</span><span class="w">&#x000A;</span><span class="n">within_activity</span><span class="w"> </span><span class="n">interact</span><span class="p">.</span><span class="n">select_file</span><span class="p">,</span><span class="w"> </span><span class="o">-&gt;</span><span class="w">&#x000A;  </span><span class="n">command_line</span><span class="o">\</span><span class="n">write</span><span class="w"> </span><span class="nb">tostring</span><span class="p">(</span><span class="n">tmpdir</span><span class="p">)</span><span class="w"> </span><span class="o">..</span><span class="w"> </span><span class="s1">'/'</span><span class="w">&#x000A;  </span><span class="n">prompt</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">command_line</span><span class="p">.</span><span class="n">prompt</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">same</span><span class="w"> </span><span class="nb">tostring</span><span class="p">(</span><span class="n">tmpdir</span><span class="p">)</span><span class="w"> </span><span class="o">..</span><span class="w"> </span><span class="s1">'/'</span><span class="p">,</span><span class="w"> </span><span class="n">prompt</span></pre>&#x000A;&#x000A;<h4 id="typing-&quot;../&quot;-switches-to-the-parent-of-the-current-directory">typing &quot;../&quot; switches to the parent of the current directory</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><span class="n">prompts</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">{}</span><span class="w">&#x000A;</span><span class="n">within_activity</span><span class="w"> </span><span class="n">interact</span><span class="p">.</span><span class="n">select_file</span><span class="p">,</span><span class="w"> </span><span class="o">-&gt;</span><span class="w">&#x000A;  </span><span class="n">command_line</span><span class="o">\</span><span class="n">write</span><span class="w"> </span><span class="nb">tostring</span><span class="p">(</span><span class="n">tmpdir</span><span class="p">)</span><span class="w"> </span><span class="o">..</span><span class="w"> </span><span class="s1">'/'</span><span class="w">&#x000A;  </span><span class="nb">table.insert</span><span class="w"> </span><span class="n">prompts</span><span class="p">,</span><span class="w"> </span><span class="n">command_line</span><span class="p">.</span><span class="n">prompt</span><span class="w">&#x000A;  </span><span class="n">command_line</span><span class="o">\</span><span class="n">write</span><span class="w"> </span><span class="nb">tostring</span><span class="p">(</span><span class="n">tmpdir</span><span class="p">)</span><span class="w"> </span><span class="o">..</span><span class="w"> </span><span class="s1">'../'</span><span class="w">&#x000A;  </span><span class="nb">table.insert</span><span class="w"> </span><span class="n">prompts</span><span class="p">,</span><span class="w"> </span><span class="n">command_line</span><span class="p">.</span><span class="n">prompt</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">same</span><span class="w"> </span><span class="p">{</span><span class="nb">tostring</span><span class="p">(</span><span class="n">tmpdir</span><span class="p">)</span><span class="w"> </span><span class="o">..</span><span class="w"> </span><span class="s1">'/'</span><span class="p">,</span><span class="w"> </span><span class="nb">tostring</span><span class="p">(</span><span class="n">tmpdir</span><span class="p">.</span><span class="n">parent</span><span class="p">)</span><span class="w"> </span><span class="o">..</span><span class="w"> </span><span class="s1">'/'</span><span class="p">},</span><span class="w"> </span><span class="n">prompts</span></pre>&#x000A;&#x000A;<h4 id="typing-&quot;/&quot;-without-any-preceeding-text-changes-to-home-directory">typing &quot;/&quot; without any preceeding text changes to home directory</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><span class="kd">local</span><span class="w"> </span><span class="n">prompt</span><span class="w">&#x000A;</span><span class="n">within_activity</span><span class="w"> </span><span class="n">interact</span><span class="p">.</span><span class="n">select_file</span><span class="p">,</span><span class="w"> </span><span class="o">-&gt;</span><span class="w">&#x000A;  </span><span class="n">command_line</span><span class="o">\</span><span class="n">write</span><span class="w"> </span><span class="s1">'/'</span><span class="w">&#x000A;  </span><span class="n">prompt</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">command_line</span><span class="p">.</span><span class="n">prompt</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">same</span><span class="w"> </span><span class="s1">'/'</span><span class="p">,</span><span class="w"> </span><span class="n">prompt</span></pre>&#x000A;&#x000A;<h4 id="shows-files-matching-entered-text-in-the-current-directory">shows files matching entered text in the current directory</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><span class="n">files</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="s1">'ab1'</span><span class="p">,</span><span class="w"> </span><span class="s1">'ab2'</span><span class="p">,</span><span class="w"> </span><span class="s1">'bc1'</span><span class="w"> </span><span class="p">}</span><span class="w">&#x000A;</span><span class="k">for</span><span class="w"> </span><span class="n">f</span><span class="w"> </span><span class="k">in</span><span class="w"> </span><span class="o">*</span><span class="n">files</span><span class="w">&#x000A;  </span><span class="n">f</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">tmpdir</span><span class="w"> </span><span class="o">/</span><span class="w"> </span><span class="n">f</span><span class="w">&#x000A;  </span><span class="n">f</span><span class="p">.</span><span class="n">contents</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'a'</span><span class="w">&#x000A;&#x000A;</span><span class="kd">local</span><span class="w"> </span><span class="n">items</span><span class="p">,</span><span class="w"> </span><span class="n">items2</span><span class="w">&#x000A;</span><span class="n">within_activity</span><span class="w"> </span><span class="n">interact</span><span class="p">.</span><span class="n">select_file</span><span class="p">,</span><span class="w"> </span><span class="o">-&gt;</span><span class="w">&#x000A;  </span><span class="n">command_line</span><span class="o">\</span><span class="n">write</span><span class="w"> </span><span class="nb">tostring</span><span class="p">(</span><span class="n">tmpdir</span><span class="p">)</span><span class="w"> </span><span class="o">..</span><span class="w"> </span><span class="s1">'/'</span><span class="w">&#x000A;  </span><span class="n">items</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">get_ui_list_widget_column</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span><span class="w">&#x000A;&#x000A;  </span><span class="n">command_line</span><span class="o">\</span><span class="n">write</span><span class="w"> </span><span class="s1">'ab'</span><span class="w">&#x000A;  </span><span class="n">items2</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">get_ui_list_widget_column</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span><span class="w">&#x000A;&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">same</span><span class="w"> </span><span class="n">files</span><span class="p">,</span><span class="w"> </span><span class="n">items</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">same</span><span class="w"> </span><span class="p">{</span><span class="s1">'ab1'</span><span class="p">,</span><span class="w"> </span><span class="s1">'ab2'</span><span class="p">},</span><span class="w"> </span><span class="n">items2</span></pre>&#x000A;<div class="spec-group spec-group-3">&#x000A;&#x000A;<h3 id=""><span class="arg-list">(when a buffer associated with a file is open)</span></h3>&#x000A;&#x000A;<pre class="highlight moonscript"><span class="kd">local</span><span class="w"> </span><span class="n">buf</span></pre>&#x000A;&#x000A;<h4 id="opens-the-directory-of-the-current-buffer,-if-any">opens the directory of the current buffer, if any</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><span class="n">buf</span><span class="p">,</span><span class="w"> </span><span class="n">app</span><span class="p">.</span><span class="n">editor</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">app</span><span class="o">\</span><span class="n">open_file</span><span class="w"> </span><span class="n">tmpdir</span><span class="w"> </span><span class="o">/</span><span class="w"> </span><span class="s1">'f'</span><span class="w">&#x000A;</span><span class="kd">local</span><span class="w"> </span><span class="n">prompt</span><span class="w">&#x000A;</span><span class="n">within_activity</span><span class="w"> </span><span class="n">interact</span><span class="p">.</span><span class="n">select_file</span><span class="p">,</span><span class="w"> </span><span class="o">-&gt;</span><span class="w">&#x000A;  </span><span class="n">prompt</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">command_line</span><span class="p">.</span><span class="n">prompt</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">same</span><span class="w"> </span><span class="nb">tostring</span><span class="p">(</span><span class="n">tmpdir</span><span class="p">)</span><span class="o">..</span><span class="s1">'/'</span><span class="p">,</span><span class="w"> </span><span class="n">prompt</span></pre>&#x000A;</div>&#x000A;<div class="spec-group spec-group-3">&#x000A;&#x000A;<h3 id=""><span class="arg-list">(spillover)</span></h3>&#x000A;<div class="spec-group spec-group-4">&#x000A;&#x000A;<h3 id=""><span class="arg-list">(..  when spillover is not an absolute path)</span></h3>&#x000A;&#x000A;<h4 id="opens-the-home-directory-and-matches-the-spillover-text">opens the home directory and matches the spillover text</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><span class="kd">local</span><span class="w"> </span><span class="n">prompt</span><span class="p">,</span><span class="w"> </span><span class="n">text</span><span class="w">&#x000A;</span><span class="n">command_line</span><span class="o">\</span><span class="n">write_spillover</span><span class="w"> </span><span class="s1">'matchthis'</span><span class="w">&#x000A;</span><span class="n">within_activity</span><span class="w"> </span><span class="n">interact</span><span class="p">.</span><span class="n">select_file</span><span class="p">,</span><span class="w"> </span><span class="o">-&gt;</span><span class="w">&#x000A;  </span><span class="n">prompt</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">command_line</span><span class="p">.</span><span class="n">prompt</span><span class="w">&#x000A;  </span><span class="n">text</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">command_line</span><span class="p">.</span><span class="n">text</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">same</span><span class="w"> </span><span class="s1">'~/'</span><span class="p">,</span><span class="w"> </span><span class="n">prompt</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">same</span><span class="w"> </span><span class="s1">'matchthis'</span><span class="p">,</span><span class="w"> </span><span class="n">text</span></pre>&#x000A;</div>&#x000A;<div class="spec-group spec-group-4">&#x000A;&#x000A;<h3 id=""><span class="arg-list">(..  when spillover is an absolute path)</span></h3>&#x000A;&#x000A;<h4 id="opens-the-closest-valid-directory">opens the closest valid directory</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><span class="kd">local</span><span class="w"> </span><span class="n">prompt</span><span class="p">,</span><span class="w"> </span><span class="n">text</span><span class="w">&#x000A;</span><span class="n">command_line</span><span class="o">\</span><span class="n">write_spillover</span><span class="w"> </span><span class="nb">tostring</span><span class="p">(</span><span class="n">tmpdir</span><span class="w"> </span><span class="o">/</span><span class="w"> </span><span class="s1">'matchthis'</span><span class="p">)</span><span class="w">&#x000A;</span><span class="n">within_activity</span><span class="w"> </span><span class="n">interact</span><span class="p">.</span><span class="n">select_file</span><span class="p">,</span><span class="w"> </span><span class="o">-&gt;</span><span class="w">&#x000A;  </span><span class="n">prompt</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">command_line</span><span class="p">.</span><span class="n">prompt</span><span class="w">&#x000A;  </span><span class="n">text</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">command_line</span><span class="p">.</span><span class="n">text</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">same</span><span class="w"> </span><span class="nb">tostring</span><span class="p">(</span><span class="n">tmpdir</span><span class="p">)</span><span class="o">..</span><span class="s1">'/'</span><span class="p">,</span><span class="w"> </span><span class="n">prompt</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">same</span><span class="w"> </span><span class="s1">'matchthis'</span><span class="p">,</span><span class="w"> </span><span class="n">text</span></pre>&#x000A;</div>&#x000A;<div class="spec-group spec-group-4">&#x000A;&#x000A;<h3 id=""><span class="arg-list">(..  when spillover is a directory path that exists)</span></h3>&#x000A;&#x000A;<pre class="highlight moonscript"><span class="n">before_each</span><span class="w"> </span><span class="o">-&gt;</span><span class="w">&#x000A;  </span><span class="nc">File</span><span class="p">.</span><span class="n">mkdir</span><span class="w"> </span><span class="n">tmpdir</span><span class="w"> </span><span class="o">/</span><span class="w"> </span><span class="s1">'subdir'</span></pre>&#x000A;&#x000A;<h4 id="opens-the-directory-when-specified-with-a-trailing-&quot;/&quot;">opens the directory when specified with a trailing &quot;/&quot;</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><span class="kd">local</span><span class="w"> </span><span class="n">prompt</span><span class="p">,</span><span class="w"> </span><span class="n">text</span><span class="w">&#x000A;</span><span class="n">command_line</span><span class="o">\</span><span class="n">write_spillover</span><span class="w"> </span><span class="nb">tostring</span><span class="p">(</span><span class="n">tmpdir</span><span class="w"> </span><span class="o">/</span><span class="w"> </span><span class="s1">'subdir'</span><span class="p">)</span><span class="w"> </span><span class="o">..</span><span class="w"> </span><span class="s1">'/'</span><span class="w">&#x000A;</span><span class="n">within_activity</span><span class="w"> </span><span class="n">interact</span><span class="p">.</span><span class="n">select_file</span><span class="p">,</span><span class="w"> </span><span class="o">-&gt;</span><span class="w">&#x000A;  </span><span class="n">prompt</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">command_line</span><span class="p">.</span><span class="n">prompt</span><span class="w">&#x000A;  </span><span class="n">text</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">command_line</span><span class="p">.</span><span class="n">text</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">same</span><span class="w"> </span><span class="nb">tostring</span><span class="p">(</span><span class="n">tmpdir</span><span class="w"> </span><span class="o">/</span><span class="w"> </span><span class="s1">'subdir'</span><span class="p">)</span><span class="o">..</span><span class="s1">'/'</span><span class="p">,</span><span class="w"> </span><span class="n">prompt</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">same</span><span class="w"> </span><span class="s1">''</span><span class="p">,</span><span class="w"> </span><span class="n">text</span></pre>&#x000A;&#x000A;<h4 id="opens-the-parent-when-specified-without-any-trailing-&quot;/&quot;">opens the parent when specified without any trailing &quot;/&quot;</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><span class="kd">local</span><span class="w"> </span><span class="n">prompt</span><span class="p">,</span><span class="w"> </span><span class="n">text</span><span class="w">&#x000A;</span><span class="n">command_line</span><span class="o">\</span><span class="n">write_spillover</span><span class="w"> </span><span class="nb">tostring</span><span class="p">(</span><span class="n">tmpdir</span><span class="w"> </span><span class="o">/</span><span class="w"> </span><span class="s1">'subdir'</span><span class="p">)</span><span class="w">&#x000A;</span><span class="n">within_activity</span><span class="w"> </span><span class="n">interact</span><span class="p">.</span><span class="n">select_file</span><span class="p">,</span><span class="w"> </span><span class="o">-&gt;</span><span class="w">&#x000A;  </span><span class="n">prompt</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">command_line</span><span class="p">.</span><span class="n">prompt</span><span class="w">&#x000A;  </span><span class="n">text</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">command_line</span><span class="p">.</span><span class="n">text</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">same</span><span class="w"> </span><span class="nb">tostring</span><span class="p">(</span><span class="n">tmpdir</span><span class="p">)</span><span class="o">..</span><span class="s1">'/'</span><span class="p">,</span><span class="w"> </span><span class="n">prompt</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">same</span><span class="w"> </span><span class="s1">'subdir'</span><span class="p">,</span><span class="w"> </span><span class="n">text</span></pre>&#x000A;</div>&#x000A;</div>&#x000A;<div class="spec-group spec-group-3">&#x000A;&#x000A;<h3 id=""><span class="arg-list">(when config.hidden_file_extensions is set)</span></h3>&#x000A;&#x000A;<pre class="highlight moonscript"><span class="kd">local</span><span class="w"> </span><span class="n">files</span><span class="w">&#x000A;&#x000A;</span><span class="n">before_each</span><span class="w"> </span><span class="o">-&gt;</span><span class="w">&#x000A;  </span><span class="n">config</span><span class="p">.</span><span class="n">reset</span><span class="o">!</span><span class="w">&#x000A;  </span><span class="n">config</span><span class="p">.</span><span class="n">hidden_file_extensions</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">{</span><span class="s1">'a'</span><span class="p">}</span><span class="w">&#x000A;  </span><span class="n">files</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="s1">'x.a'</span><span class="p">,</span><span class="w"> </span><span class="s1">'x.b'</span><span class="p">,</span><span class="w"> </span><span class="s1">'x.c'</span><span class="w"> </span><span class="p">}</span><span class="w">&#x000A;  </span><span class="k">for</span><span class="w"> </span><span class="n">f</span><span class="w"> </span><span class="k">in</span><span class="w"> </span><span class="o">*</span><span class="n">files</span><span class="w">&#x000A;    </span><span class="n">f</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">tmpdir</span><span class="w"> </span><span class="o">/</span><span class="w"> </span><span class="n">f</span><span class="w">&#x000A;    </span><span class="n">f</span><span class="p">.</span><span class="n">contents</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'x'</span></pre>&#x000A;&#x000A;<h4 id="does-not-show-hidden-files-in-list">does not show hidden files in list</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><span class="kd">local</span><span class="w"> </span><span class="n">items</span><span class="w">&#x000A;</span><span class="n">within_activity</span><span class="w"> </span><span class="n">interact</span><span class="p">.</span><span class="n">select_file</span><span class="p">,</span><span class="w"> </span><span class="o">-&gt;</span><span class="w">&#x000A;  </span><span class="n">command_line</span><span class="o">\</span><span class="n">write</span><span class="w"> </span><span class="nb">tostring</span><span class="p">(</span><span class="n">tmpdir</span><span class="p">)</span><span class="w"> </span><span class="o">..</span><span class="w"> </span><span class="s1">'/'</span><span class="w">&#x000A;  </span><span class="n">items</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">get_ui_list_widget_column</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">same</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="s1">'x.b'</span><span class="p">,</span><span class="w"> </span><span class="s1">'x.c'</span><span class="w"> </span><span class="p">},</span><span class="w"> </span><span class="n">items</span></pre>&#x000A;&#x000A;<h4 id="shows-a-hidden-file-after-its-exact-name-is-entered">shows a hidden file after its exact name is entered</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><span class="kd">local</span><span class="w"> </span><span class="n">items</span><span class="w">&#x000A;</span><span class="n">within_activity</span><span class="w"> </span><span class="n">interact</span><span class="p">.</span><span class="n">select_file</span><span class="p">,</span><span class="w"> </span><span class="o">-&gt;</span><span class="w">&#x000A;  </span><span class="n">command_line</span><span class="o">\</span><span class="n">write</span><span class="w"> </span><span class="nb">tostring</span><span class="p">(</span><span class="n">tmpdir</span><span class="p">)</span><span class="w"> </span><span class="o">..</span><span class="w"> </span><span class="s1">'/'</span><span class="w">&#x000A;  </span><span class="n">command_line</span><span class="o">\</span><span class="n">write</span><span class="w"> </span><span class="s1">'x.a'</span><span class="w">&#x000A;  </span><span class="n">command_line</span><span class="o">\</span><span class="n">clear</span><span class="o">!</span><span class="w">&#x000A;  </span><span class="n">command_line</span><span class="o">\</span><span class="n">write</span><span class="w"> </span><span class="s1">''</span><span class="w">&#x000A;  </span><span class="n">items</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">get_ui_list_widget_column</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">same</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="s1">'x.b'</span><span class="p">,</span><span class="w"> </span><span class="s1">'x.c'</span><span class="p">,</span><span class="w"> </span><span class="s1">'x.a'</span><span class="w"> </span><span class="p">},</span><span class="w"> </span><span class="n">items</span></pre>&#x000A;</div>&#x000A;<div class="spec-group spec-group-3">&#x000A;&#x000A;<h3 id=""><span class="arg-list">(in subtree mode)</span></h3>&#x000A;&#x000A;<h4 id="shows-files-and-directories-in-the-subtree">shows files and directories in the subtree</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><span class="n">files</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="s1">'ab1'</span><span class="p">,</span><span class="w"> </span><span class="s1">'ab2/'</span><span class="p">,</span><span class="w"> </span><span class="s1">'ab2/xy'</span><span class="p">,</span><span class="w"> </span><span class="s1">'ef/'</span><span class="p">,</span><span class="w"> </span><span class="s1">'ef/gh/'</span><span class="p">,</span><span class="w"> </span><span class="s1">'ef/gh/ab4'</span><span class="p">}</span><span class="w">&#x000A;</span><span class="k">for</span><span class="w"> </span><span class="n">name</span><span class="w"> </span><span class="k">in</span><span class="w"> </span><span class="o">*</span><span class="n">files</span><span class="w">&#x000A;  </span><span class="n">f</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">tmpdir</span><span class="w"> </span><span class="o">/</span><span class="w"> </span><span class="n">name</span><span class="w">&#x000A;  </span><span class="k">if</span><span class="w"> </span><span class="n">name</span><span class="o">\</span><span class="n">ends_with</span><span class="w"> </span><span class="s1">'/'</span><span class="w">&#x000A;    </span><span class="n">f</span><span class="o">\</span><span class="n">mkdir</span><span class="o">!</span><span class="w">&#x000A;  </span><span class="k">else</span><span class="w">&#x000A;    </span><span class="n">f</span><span class="p">.</span><span class="n">contents</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'a'</span><span class="w">&#x000A;&#x000A;</span><span class="n">command_line</span><span class="o">\</span><span class="n">write_spillover</span><span class="w"> </span><span class="nb">tostring</span><span class="p">(</span><span class="n">tmpdir</span><span class="p">)</span><span class="w"> </span><span class="o">..</span><span class="w"> </span><span class="s1">'/'</span><span class="w">&#x000A;&#x000A;</span><span class="kd">local</span><span class="w"> </span><span class="n">items</span><span class="p">,</span><span class="w"> </span><span class="n">items2</span><span class="w">&#x000A;</span><span class="n">within_activity</span><span class="w"> </span><span class="p">(</span><span class="o">-&gt;</span><span class="w"> </span><span class="n">interact</span><span class="p">.</span><span class="n">select_file</span><span class="p">(</span><span class="ss">show_subtree:</span><span class="w"> </span><span class="kc">true</span><span class="p">)),</span><span class="w"> </span><span class="o">-&gt;</span><span class="w">&#x000A;  </span><span class="n">items</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">get_ui_list_widget_column</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span><span class="w">&#x000A;  </span><span class="n">command_line</span><span class="o">\</span><span class="n">write</span><span class="w"> </span><span class="s1">'ab'</span><span class="w">&#x000A;  </span><span class="n">items2</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">get_ui_list_widget_column</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span><span class="w">&#x000A;&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">same</span><span class="w"> </span><span class="n">files</span><span class="p">,</span><span class="w"> </span><span class="n">items</span><span class="w">&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">same</span><span class="w"> </span><span class="p">{</span><span class="s1">'ab1'</span><span class="p">,</span><span class="w"> </span><span class="s1">'ab2/'</span><span class="p">,</span><span class="w"> </span><span class="s1">'ab2/xy'</span><span class="p">,</span><span class="w"> </span><span class="s1">'ef/gh/ab4'</span><span class="p">},</span><span class="w"> </span><span class="n">items2</span></pre>&#x000A;</div>&#x000A;</div>&#x000A;<div class="spec-group spec-group-2">&#x000A;&#x000A;<h2 id="interact.select_directory">interact.select_directory</h2>&#x000A;&#x000A;<h4 id="shows-only-sub-directories-including-&quot;./&quot;,-but-no-files">shows only sub directories including &quot;./&quot;, but no files</h4>&#x000A;&#x000A;<pre class="highlight moonscript"><span class="n">files</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="s1">'ab1'</span><span class="p">,</span><span class="w"> </span><span class="s1">'ab2'</span><span class="p">,</span><span class="w"> </span><span class="s1">'bc1'</span><span class="w"> </span><span class="p">}</span><span class="w">&#x000A;</span><span class="n">directories</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="s1">'dir1'</span><span class="p">,</span><span class="w"> </span><span class="s1">'dir2'</span><span class="w"> </span><span class="p">}</span><span class="w">&#x000A;</span><span class="k">for</span><span class="w"> </span><span class="n">f</span><span class="w"> </span><span class="k">in</span><span class="w"> </span><span class="o">*</span><span class="n">files</span><span class="w">&#x000A;  </span><span class="n">f</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">tmpdir</span><span class="w"> </span><span class="o">/</span><span class="w"> </span><span class="n">f</span><span class="w">&#x000A;  </span><span class="n">f</span><span class="p">.</span><span class="n">contents</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s1">'a'</span><span class="w">&#x000A;&#x000A;</span><span class="k">for</span><span class="w"> </span><span class="n">d</span><span class="w"> </span><span class="k">in</span><span class="w"> </span><span class="o">*</span><span class="n">directories</span><span class="w">&#x000A;  </span><span class="n">f</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">tmpdir</span><span class="w"> </span><span class="o">/</span><span class="w"> </span><span class="n">d</span><span class="w">&#x000A;  </span><span class="n">f</span><span class="o">\</span><span class="n">mkdir</span><span class="o">!</span><span class="w">&#x000A;&#x000A;</span><span class="kd">local</span><span class="w"> </span><span class="n">items</span><span class="w">&#x000A;</span><span class="n">within_activity</span><span class="w"> </span><span class="n">interact</span><span class="p">.</span><span class="n">select_directory</span><span class="p">,</span><span class="w"> </span><span class="o">-&gt;</span><span class="w">&#x000A;  </span><span class="n">command_line</span><span class="o">\</span><span class="n">write</span><span class="w"> </span><span class="nb">tostring</span><span class="p">(</span><span class="n">tmpdir</span><span class="p">)</span><span class="w"> </span><span class="o">..</span><span class="w"> </span><span class="s1">'/'</span><span class="w">&#x000A;  </span><span class="n">items</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">get_ui_list_widget_column</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span><span class="w">&#x000A;&#x000A;</span><span class="n">assert</span><span class="p">.</span><span class="n">same</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="s1">'./'</span><span class="p">,</span><span class="w"> </span><span class="s1">'dir1/'</span><span class="p">,</span><span class="w"> </span><span class="s1">'dir2/'</span><span class="w"> </span><span class="p">},</span><span class="w"> </span><span class="n">items</span></pre>&#x000A;</div>&#x000A;</div>
      <div class='footer text-muted'>
        <a href='/'>
          <img width="50" height="50" class="footer-logo" src="/images/howl.png" />
        </a>
        <div class='footer-follow'>
          <p>
            <a class='twitter-follow-button' data-lang='en' data-show-count='false' href='https://twitter.com/howleditor' rel='me'>
              Follow @howleditor
            </a>
          </p>
          <p>
            <a class='twitter-share-button' data-count='none' data-hashtags='howleditor' data-lang='en' data-text='The Howl Editor, a general purpose, light-weight customizable editor.' data-url='http://howl.io' href='https://twitter.com/share'>
              Tweet
            </a>
          </p>
        </div>
        <div class='footer-blurb'>
          <div>The Howl editor.</div>
          <div>
            Copyright 2012-2016
            <a class='alert-link' href='https://github.com/howl-editor/howl/contributors'>
              The Howl Developers.
            </a>
          </div>
        </div>
      </div>
    </div>
    <script>
      <!-- / GA -->
      (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
      (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
      m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
      })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
      ga('create', 'UA-45283282-1', 'howl.io');
      ga('send', 'pageview');
      <!-- / Twitter -->
      !function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];
      if(!d.getElementById(id)){js=d.createElement(s);js.id=id;
      js.src="//platform.twitter.com/widgets.js";
      fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");
    </script>
  </body>
</html>
